package org.wu.mp.utils;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
public class JsonResult {

    private int code;
    private String msg;
    private Object data;

    public JsonResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static JsonResult success(){
        return new JsonResult(200,"操作成功",null);
    }

    public static JsonResult success(Object data){
        return new JsonResult(200,"操作成功",data);
    }

    public static JsonResult error(String mag){
        return new JsonResult(500,mag,null);
    }


}
